import {
  OrderModel
} from '../../models/orderData.js'
let orderModel = new OrderModel()
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  pageLifetimes: {
    show() {
      wx.showLoading({
        mask: true
      })
      let data = orderModel.getOrderList({
        listId: '285f7202-2b0a-42b1-ab1b-9302f53917db',
        unitId: 'c91854d1-b301-49fb-aba1-7cac8e161e8e',
        pageCode: 'ATC.Order.List',
        schemaId: 'e72a4bd8-d5ce-4a3e-bd8d-89b8a0bb29ce'
      })
      data.then(res => {
        console.log(res)
        if(res.data.success) {
          if(res.data.data.data.records) {
            this.setData({
              listData: res.data.data.data.records
            })
          }
        } else {
          wx.showModal({
            showCancel: false,
            title: '提示',
            content: res.data.data.msg
          })
        }
        wx.hideLoading()
      })
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    listData: []
  },

  /**
   * 组件的方法列表
   */
  methods: {
    clickOrder(event) {
      wx.navigateTo({
        url: `/pages/orderDetail/orderDetail?FId=${event.detail.orderData.FId}&companyId=${event.detail.orderData.FCompany}`,
      })
    }
  }
})